home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 November / Chip Kasım 2000.iso / prog / share / 11 / setup.exe / %MAINDIR% / DEMOS / CISERVER / CHAT / frmSetup.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2000-09-07  |  6.6 KB  |  209 lines

  1. VERSION 4.00
  2. Begin VB.Form frmSetup 
  3.    Caption         =   "Chat Setup"
  4.    ClientHeight    =   1740
  5.    ClientLeft      =   2280
  6.    ClientTop       =   1575
  7.    ClientWidth     =   5790
  8.    Height          =   2220
  9.    Left            =   2220
  10.    LinkTopic       =   "Form2"
  11.    ScaleHeight     =   1740
  12.    ScaleWidth      =   5790
  13.    Top             =   1155
  14.    Width           =   5910
  15.    Begin VB.Frame Frame1 
  16.       Caption         =   "Chat Settings:"
  17.       Height          =   1545
  18.       Left            =   90
  19.       TabIndex        =   0
  20.       Top             =   90
  21.       Width           =   5595
  22.       Begin VB.CommandButton Command1 
  23.          Caption         =   "Exit"
  24.          Height          =   375
  25.          Left            =   3960
  26.          TabIndex        =   10
  27.          Top             =   990
  28.          Width           =   1455
  29.       End
  30.       Begin VB.CommandButton cmdConnect 
  31.          Caption         =   "Connect to Host"
  32.          Enabled         =   0   'False
  33.          Height          =   375
  34.          Left            =   3960
  35.          TabIndex        =   9
  36.          Top             =   360
  37.          Width           =   1455
  38.       End
  39.       Begin VB.TextBox txtPort 
  40.          Height          =   285
  41.          Left            =   2160
  42.          TabIndex        =   4
  43.          Top             =   450
  44.          Width           =   1545
  45.       End
  46.       Begin VB.TextBox txtHostAddress 
  47.          Height          =   285
  48.          Left            =   2160
  49.          TabIndex        =   8
  50.          Top             =   1080
  51.          Width           =   1545
  52.       End
  53.       Begin VB.TextBox txtHostName 
  54.          Height          =   285
  55.          Left            =   180
  56.          TabIndex        =   6
  57.          Top             =   1080
  58.          Width           =   1545
  59.       End
  60.       Begin VB.TextBox txtName 
  61.          Height          =   285
  62.          Left            =   180
  63.          TabIndex        =   2
  64.          Top             =   450
  65.          Width           =   1545
  66.       End
  67.       Begin VB.Label Label4 
  68.          Caption         =   "Port Number:"
  69.          Height          =   195
  70.          Left            =   2160
  71.          TabIndex        =   3
  72.          Top             =   270
  73.          Width           =   1545
  74.       End
  75.       Begin VB.Label Label3 
  76.          Caption         =   "HostAddress:"
  77.          Height          =   285
  78.          Left            =   2160
  79.          TabIndex        =   7
  80.          Top             =   900
  81.          Width           =   1545
  82.       End
  83.       Begin VB.Label Label2 
  84.          Caption         =   "HostName:"
  85.          Height          =   285
  86.          Left            =   180
  87.          TabIndex        =   5
  88.          Top             =   900
  89.          Width           =   1545
  90.       End
  91.       Begin VB.Label Label1 
  92.          Caption         =   "Screen Name:"
  93.          Height          =   285
  94.          Left            =   180
  95.          TabIndex        =   1
  96.          Top             =   270
  97.          Width           =   1545
  98.       End
  99.    End
  100. Attribute VB_Name = "frmSetup"
  101. Attribute VB_Creatable = False
  102. Attribute VB_Exposed = False
  103. Private Sub CITCP1_Connection(ByVal address As String)
  104. Print address
  105. End Sub
  106. Private Sub CITCP1_PacketReceived(Packet As Variant, ByVal bytes_in As Integer)
  107. 'If packet arrives, display it
  108. Print Packet
  109. End Sub
  110. Private Sub cmdConnect_Click()
  111. Dim temp As Variant
  112. On Error GoTo Connect_Failure
  113. ScreenName = txtName.Text
  114. ' port numbers should be in the range of 1 to 65535
  115. ' for port number greater than 32767 a negative number
  116. ' needs to be used to conform to VB's Integer data type.
  117. temp = Int(Val(txtPort.Text))
  118. If temp < -32768 Or temp > 32767 Or temp = 0 Then 'invalid port
  119.     MsgBox "Port number must be between -32768 and 32767 excluding the value of zero", 0, "Invalid Parameter"
  120.     txtPort.SelStart = 0
  121.     txtPort.SelLength = Len(txtPort.Text)
  122.     txtPort.SetFocus
  123.     Exit Sub
  124. End If
  125. 'Check for valid HostName and Address
  126. PortNum = temp
  127. If txtHostName.Text <> "" Then
  128.     HostName = txtHostName.Text
  129.     HostAddress = txtHostAddress.Text
  130. End If
  131. 'Display the client form
  132. frmClient.Show
  133. Unload Me
  134. Exit Sub
  135. Connect_Failure:
  136.     Resume Exit_Sub
  137. Exit_Sub:
  138. End Sub
  139. Private Sub Command1_Click()
  140. 'Unload the form
  141. Unload Me
  142. End Sub
  143. Private Sub Form_Activate()
  144. 'Set focus to the Active form
  145. txtName.SetFocus
  146. End Sub
  147. Private Sub Form_Load()
  148. 'center form on screen and set
  149. Me.Top = Screen.Height / 2 - Me.Height / 2
  150. Me.Left = Screen.Width / 2 - Me.Width / 2
  151. 'Set Port Number, Host Name and Address
  152. If PortNum <> 0 Then txtPort.Text = PortNum
  153.     txtHostAddress.Text = HostAddress
  154.     txtHostName.Text = HostName
  155.     txtName.Text = ScreenName
  156. End Sub
  157. Private Sub txtHostAddress_Change()
  158. 'Validate entries on the form
  159. If txtHostName.Text = "" And txtHostAddress.Text <> "" Then
  160.     txtHostName.TabStop = False
  161.     txtHostName.BackColor = vbGrayText
  162.     txtHostName.TabStop = True
  163.     txtHostName.BackColor = &H80000005
  164. End If
  165. ' If all entries are made, enable connection
  166. If txtName.Text <> "" And txtPort.Text <> "" And (txtHostName.Text <> "" Or txtHostAddress.Text <> "") Then
  167.     cmdConnect.Enabled = True
  168.     cmdConnect.Default = True
  169.     cmdConnect.Enabled = False
  170.     cmdConnect.Default = False
  171. End If
  172. End Sub
  173. Private Sub txtHostName_Change()
  174. ' Host name is being modified/changed set properties
  175. If txtHostName.Text <> "" Then
  176.     txtHostAddress.BackColor = vb3DShadow
  177.     txtHostAddress.TabStop = False
  178.     txtHostName.BackColor = &H80000005
  179.     txtHostAddress.TabStop = True
  180.     txtHostAddress.BackColor = &H80000005
  181.     If txtHostAddress <> "" Then txtHostName.BackColor = vb3DShadow
  182. End If
  183. ' If all entries are made, enable connection
  184. If txtName.Text <> "" And txtPort.Text <> "" And (txtHostName.Text <> "" Or txtHostAddress.Text <> "") Then
  185.     cmdConnect.Enabled = True
  186.     cmdConnect.Default = True
  187.     cmdConnect.Enabled = False
  188.     cmdConnect.Default = False
  189. End If
  190. End Sub
  191. Private Sub txtName_Change()
  192. ' Name is being modified/changed
  193. If txtName.Text <> "" And txtPort.Text <> "" And (txtHostName.Text <> "" Or txtHostAddress.Text <> "") Then
  194.     cmdConnect.Enabled = True
  195.     cmdConnect.Default = True
  196.     cmdConnect.Enabled = False
  197.     cmdConnect.Default = False
  198. End If
  199. End Sub
  200. Private Sub txtPort_Change()
  201. 'Port is being modified/changed
  202. If txtName.Text <> "" And txtPort.Text <> "" And (txtHostName.Text <> "" Or txtHostAddress.Text <> "") Then
  203.     cmdConnect.Enabled = True
  204.     cmdConnect.Default = True
  205.     cmdConnect.Enabled = False
  206.     cmdConnect.Default = False
  207. End If
  208. End Sub
  209.